package com.ruoyi.basedata.api;

import com.ruoyi.basedata.api.factory.RemoteGoodsFallbackFactory;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.domain.basedata.Goods;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

@FeignClient(contextId = "remoteGoodsService", value = ServiceNameConstants.BASEDATA_SERVICE, fallbackFactory = RemoteGoodsFallbackFactory.class)
public interface RemoteGoodsService {

    @PostMapping("/goods/getListByIds")
    public R<List<Goods>> getGoodsListByIds(@RequestBody List<Integer> ids, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/goods/getGoodsById")
    public R<Goods> getGoodsById(@RequestBody Integer id);

    @GetMapping("/goods/cost/goodsId/{id}")
    public R<BigDecimal> getCostByGoodsId(@PathVariable("id") Integer id);

    @PutMapping("/goods")
    public AjaxResult edit(@RequestBody Goods goods);
}
